home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / srcuc.zip / CONST.H < prev    next >
C/C++ Source or Header  |  1991-07-23  |  6KB  |  188 lines

  1. /* -*-C-*-
  2.  
  3. Copyright (c) 1987-1991 Massachusetts Institute of Technology
  4.  
  5. This material was developed by the Scheme project at the Massachusetts
  6. Institute of Technology, Department of Electrical Engineering and
  7. Computer Science.  Permission to copy this software, to redistribute
  8. it, and to use it for any purpose is granted, subject to the following
  9. restrictions and understandings.
  10.  
  11. 1. Any copy made of this software must include this copyright notice
  12. in full.
  13.  
  14. 2. Users of this software agree to make their best efforts (a) to
  15. return to the MIT Scheme project any improvements or extensions that
  16. they make, so that these may be included in future releases; and (b)
  17. to inform MIT of noteworthy uses of this software.
  18.  
  19. 3. All materials developed as a consequence of the use of this
  20. software shall duly acknowledge such use, in accordance with the usual
  21. standards of acknowledging credit in academic research.
  22.  
  23. 4. MIT has made no warrantee or representation that the operation of
  24. this software will be error-free, and MIT is under no obligation to
  25. provide any services, by way of maintenance, update, or otherwise.
  26.  
  27. 5. In conjunction with products arising from the use of this material,
  28. there shall be no use of the name of the Massachusetts Institute of
  29. Technology nor of any adaptation thereof in any advertising,
  30. promotional, or sales literature without prior written consent from
  31. MIT in each case. */
  32.  
  33. /* $Header: /scheme/microcode/RCS/const.h,v 9.39 1991/07/24 02:26:55 cph Exp $
  34.  *
  35.  * Named constants used throughout the interpreter
  36.  *
  37.  */
  38.  
  39. #if (CHAR_BIT != 8)
  40. #define MAX_CHAR        ((1<<CHAR_BIT)-1)
  41. #else
  42. #define MAX_CHAR        0xFF
  43. #endif
  44.  
  45. #define PI            3.1415926535
  46. #define STACK_FRAME_HEADER    1
  47.  
  48. /* Precomputed typed pointers */
  49. #ifdef b32            /* 32 bit word */
  50.  
  51. #if (TYPE_CODE_LENGTH == 8)
  52. #define SHARP_F            0x00000000
  53. #define SHARP_T            0x08000000
  54. #define UNSPECIFIC        0x08000001
  55. #define FIXNUM_ZERO        0x1A000000
  56. #define BROKEN_HEART_ZERO    0x22000000
  57. #endif /* (TYPE_CODE_LENGTH == 8) */
  58.  
  59. #if (TYPE_CODE_LENGTH == 6)
  60. #define SHARP_F            0x00000000
  61. #define SHARP_T            0x20000000
  62. #define UNSPECIFIC        0x20000001
  63. #define FIXNUM_ZERO        0x68000000
  64. #define BROKEN_HEART_ZERO    0x88000000
  65. #endif /* (TYPE_CODE_LENGTH == 6) */
  66.  
  67. #endif /* b32 */
  68.  
  69. #ifndef SHARP_F            /* Safe version */
  70. #define SHARP_F            MAKE_OBJECT (TC_NULL, 0)
  71. #define SHARP_T            MAKE_OBJECT (TC_TRUE, 0)
  72. #define UNSPECIFIC        MAKE_OBJECT (TC_TRUE, 1)
  73. #define FIXNUM_ZERO        MAKE_OBJECT (TC_FIXNUM, 0)
  74. #define BROKEN_HEART_ZERO    MAKE_OBJECT (TC_BROKEN_HEART, 0)
  75. #endif /* SHARP_F */
  76.  
  77. #define EMPTY_LIST SHARP_F
  78.  
  79. /* Assorted sizes used in various places */
  80.  
  81. #ifdef MAXPATHLEN
  82. #define FILE_NAME_LENGTH    MAXPATHLEN
  83. #else
  84. #define FILE_NAME_LENGTH    1024       /* Max. chars. in a file name */
  85. #endif
  86.  
  87. #define OBARRAY_SIZE        3001    /* Interning hash table */
  88.  
  89. #ifndef STACK_GUARD_SIZE
  90. #define STACK_GUARD_SIZE    4096    /* Cells between constant and
  91.                        stack before overflow
  92.                        occurs */
  93. #endif
  94.  
  95. /* Some versions of stdio define this. */
  96. #ifndef _NFILE
  97. #define _NFILE        15
  98. #endif
  99.  
  100. #define FILE_CHANNELS        _NFILE
  101.  
  102. #define MAX_LIST_PRINT        10
  103.  
  104. #define ILLEGAL_PRIMITIVE    -1
  105.  
  106. /* Last immediate reference trap. */
  107.  
  108. #define TRAP_MAX_IMMEDIATE    9
  109.  
  110. /* For headers in pure / constant area */
  111.  
  112. #define END_OF_BLOCK        TC_FIXNUM
  113. #define CONSTANT_PART        TC_TRUE
  114. #define PURE_PART        TC_FALSE
  115.  
  116. /* Primitive flow control codes: directs computation after
  117.  * processing a primitive application.
  118.  */
  119.  
  120. #define PRIM_DONE            -1
  121. #define PRIM_DO_EXPRESSION        -2
  122. #define PRIM_APPLY            -3
  123. #define PRIM_INTERRUPT            -4
  124. #define PRIM_NO_TRAP_EVAL        -5
  125. #define PRIM_NO_TRAP_APPLY        -6
  126. #define PRIM_POP_RETURN            -7
  127. #define PRIM_TOUCH            -8
  128. #define PRIM_APPLY_INTERRUPT        -9
  129. #define PRIM_REENTER            -10
  130. #define PRIM_NO_TRAP_POP_RETURN        -11
  131.  
  132. #define ABORT_NAME_TABLE                        \
  133. {                                    \
  134.   /* -1 */    "DONE",                            \
  135.   /* -2 */    "DO-EXPRESSION",                    \
  136.   /* -3 */    "APPLY",                        \
  137.   /* -4 */    "INTERRUPT",                        \
  138.   /* -5 */    "NO-TRAP-EVAL",                        \
  139.   /* -6 */    "NO-TRAP_APPLY",                    \
  140.   /* -7 */    "POP-RETURN",                        \
  141.   /* -8 */    "TOUCH",                        \
  142.   /* -9 */    "APPLY-INTERRUPT",                    \
  143.   /* -10 */    "REENTER",                        \
  144.   /* -11 */    "NO-TRAP-POP-RETURN"                    \
  145. }
  146.  
  147. /* Some numbers of parameters which mean something special */
  148.  
  149. #define LEXPR_PRIMITIVE_ARITY        -1
  150. #define UNKNOWN_PRIMITIVE_ARITY        -2
  151.  
  152. /* Error case detection for precomputed constants */
  153. /* VMS preprocessor does not like line continuations in conditionals */
  154.  
  155. #define Are_The_Constants_Incompatible                    \
  156. ((TC_NULL != 0x00) || (TC_TRUE != 0x08) ||                \
  157.  (TC_FIXNUM != 0x1A) || (TC_BROKEN_HEART != 0x22) ||             \
  158.  (TC_CHARACTER_STRING != 0x1E))
  159.  
  160. /* The values used above are in sdata.h and types.h,
  161.    check for consistency if the check below fails. */
  162.  
  163. #if Are_The_Constants_Incompatible
  164. #include "Error: const.h and types.h disagree"
  165. #endif
  166.  
  167. /* These are the only entries in Registers[] needed by the microcode.
  168.    All other entries are used only by the compiled code interface. */
  169.  
  170. #define REGBLOCK_MEMTOP            0
  171. #define REGBLOCK_STACKGUARD        1
  172. #define REGBLOCK_VAL            2
  173. #define REGBLOCK_ENV            3
  174. #define REGBLOCK_COMPILER_TEMP        4    /* For use by compiler */
  175. #define REGBLOCK_EXPR            5
  176. #define REGBLOCK_RETURN            6
  177. #define REGBLOCK_LEXPR_ACTUALS        7
  178. #define REGBLOCK_PRIMITIVE        8
  179. #define REGBLOCK_CLOSURE_FREE        9    /* For use by compiler */
  180. #define REGBLOCK_CLOSURE_SPACE        10    /* For use by compiler */
  181. #define REGBLOCK_MINIMUM_LENGTH        11
  182.  
  183. /* Codes specifying how to start scheme at boot time. */
  184.  
  185. #define BOOT_FASLOAD        0
  186. #define BOOT_LOAD_BAND        1
  187. #define BOOT_GET_WORK        2
  188.